﻿@model abc.Models.PersonalInformation

@{
    ViewBag.Title = "ShowContactInforamtion";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<style>
    .datepicker {
       z-index:10000!important;
    }
   
</style>

<div class="col-md-12">
<!---Personal Information VIew--->
<div class="box box-info">
    <div class="box-header with-border">
        <h3 class="box-title">Personal Information</h3>
        <div class="box-tools pull-right">
            <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
            <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
        </div>
    </div><!-- /.box-header -->
    <div class="box-body">
        <div class="table-responsive">
            <table class="table no-margin">
                <thead>
                    <tr>
                        <th>First Name</th>
                        <th>Last Name</th>
                        <th>Date Of Birth</th>
                        <th>Gender</th>
                        <th>Maritial Status</th>
                        <th>Edit</th>
                    </tr>
                </thead>
              
                   @{
                       
                       
                       foreach (var item in ViewBag.GetPersonalInformationByRegistrationId)
                       {
                           <tbody>
                    <tr>
                        <td>@item.PersonalInformation_FirstName</td>
                        <td>@item.PersonalInformation_LastName</td>
                        <td>@item.PersonalInformation_DateOfBirth</td>
                        <td>@item.PersonalInformation_Gender</td>
                        <td>@item.PersonalInformation_MaritialStatus</td>
                       <td> @{
                           using (Html.BeginForm("EditPersonalInformation", "RecruitmentZone", FormMethod.Post))
                           {
                            <input type="hidden" id="PersonalInformation_Id" name="PersonalInformation_Id" value="@item.PersonalInformation_Id" />
                            <input type="submit" class="btn btn-default btn-sm" value="Edit" />
                           }
                           }
                        </td>
                    
                     </tr>
                       </tbody>
                        }

               
                   }
                       
                        
                        
               
            </table>
        </div><!-- /.table-responsive -->
    </div><!-- /.box-body -->
    <div class="box-footer clearfix">
    @if (ViewBag.GetPersonalInformationByRegistrationId==null)
    {
        <a href="#" class="btn btn-sm btn-info btn-flat pull-left" data-toggle="modal" data-target="#PI-modal">Add Personal Information </a>
    }
    else
    {
             <a href="#" class="btn btn-sm btn-info btn-flat disabled pull-left" data-toggle="modal" data-target="#PI-modal">Add Personal Information </a>
    }
        
        <a href="#" class="btn btn-sm btn-default btn-flat pull-right">Cancel</a>
    </div><!-- /.box-footer -->
</div>
    </div>
<!---Personal Information Modal--->

      <div class="personal-information">
    <div class="modal modal-primary modal fade" tabindex="-1"  id="PI-modal" >
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <h4 class="personal-information">Update Personal Information</h4>
                </div>
@{
                      using (@Html.BeginForm("SavePersonalInformation","RecruitmentZone", FormMethod.Post, new { @class = "form-horizontal" }))
                      {

              <div class="modal-body">
            
                 
                                  
                  <fieldset>

                      <legend>Personal Information</legend>

                  </fieldset>
                            <div class="form-group">
                                <label for="firstName" class="col-sm-3 control-label">First Name</label>
                                <div class="col-sm-9">
                                   @Html.TextBoxFor(d => d.PersonalInformation_FirstName, new { @class="form-control",@placeholder="First Name"})
                            @*<input type="text" name="PersonalInformation_FirstName" value="@Model.PersonalInformation_FirstName " id="fullName" class="form-control" />*@
                                </div>
                            </div>
                        
                      
                        <div class="form-group">
                            <label for="LastName" class="col-sm-3 control-label">Last Name</label>
                            <div class="col-sm-9">
                             @Html.TextBoxFor(d => d.PersonalInformation_LastName, new { @class="form-control",@placeholder="Last Name"})
                                   @*<input type="text" name="PersonalInformation_LastName" value="@Model.PersonalInformation_LastName" id="lastName" class="form-control" />*@
                            </div>
                        </div>
                     
                         <div class="form-group">
                            <label for="date-picker-2" class="control-label col-sm-3">Date Of Birth</label>
                            <div id="DateTimePicker1"class="input-append date col-sm-9" >                                                                                                                          
                                <div class="input-group" >
                                   
                                    <input type="hidden" name="PersonalInformation_DateOfBirth" value="@Model.PersonalInformation_DateOfBirth" id="HiddenDOB" />
                                    <input type="text" style="color:black" id="TextDOB"data-format="DD-MM-YYYY" disabled="disabled" class="form-control" />
                                    <div class="input-group-addon">
                                          <i class="fa fa-calendar"></i>
                                    </div>
                                </div>                       
                        </div>
                             </div>
                        <div class="form-group">

                            <label for="gender" class="col-sm-3 control-label">Gender</label>
                            
                            <div class="col-sm-9">
                                <div class="radio">
                                    <label> 
                                    @Html.RadioButtonFor(d => d.PersonalInformation_Gender, true)
                                        @*<input type="radio" name="Gender" value="F" />*@    
                                     Male</label><br />
                                </div>
                                <div class="radio">
                                    <label>
                                        @Html.RadioButtonFor(d => d.PersonalInformation_Gender, false)
                                        @*<input type="radio" name="Gender" value="F" />*@
                                        Female
                                    </label><br />
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="maritialstatus" class="col-sm-3 control-label">Maritial Status</label>
                            <div class="col-sm-9">
                                <div class="radio">
                                    
                                        @Html.RadioButtonFor(d => d.PersonalInformation_MaritialStatus, true)
                                    Married
                                        <br />
                                </div>
                                <div class="radio">
                                    
                                        @Html.RadioButtonFor(d => d.PersonalInformation_MaritialStatus, false)
                                       
                                    Unmarried
                                    <br />
                                </div>
                            </div>
                        </div>

                      

                
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-outline pull-left "aria-hidden="true"  data-dismiss="modal">Close</button>
                    <button type="submit" class="btn btn-outline" onclick="SaveDetails(this)">Save changes</button>
                </div>
}
}    
                   </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</div>
  

    
@section scripts
{
    <script>


        function SaveDetails(e) {
            var TextDOB = $("#TextDOB").val();
            $("#HiddenDOB").val(TextDOB);
            e.parentElement.parentElement.submit();
        }

        $(document).ready(function() {
            var HiddenDOB = $("#HiddenDOB").val();
            $("#TextDOB").val(HiddenDOB);
        });


        $('#DateTimePicker1').datepicker(
            {
                dateFormat: 'dd-mm-yy',
                minDate: '+5d',
                changeMonth: true,
                changeYear: true,

            }).on('changeDate', function (e) {
                $(this).datepicker('hide');

            });
  
</script>



}
